package ioc.circular_dependency2.async;

import lombok.Data;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;

import java.util.concurrent.TimeUnit;

/**
 * @author chaird
 * @create 2023-04-11 23:49
 */
@Data
@Service
public class A {
    @Autowired
    private B b;

    @Async
    public void m1(){

    System.out.println("sleep start");
        try { TimeUnit.SECONDS.sleep(10000); } catch (Exception e) { e.printStackTrace(); } finally { }
        System.out.println("sleep end");


    }

    @Override
    public String toString() {
        return "A{" +
                '}';
    }
}
